<%--
  Created by IntelliJ IDEA.
  User: 15458
  Date: 2025/3/18
  Time: 13:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 电商助农平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(45deg, #ff9a9e, #fad0c4, #fbc2eb, #a6c1ee, #f6d365, #fda085);
            background-size: 400% 400%;
            animation: gradientBG 10s ease infinite;
        }
        @keyframes gradientBG {
            0% {
                background-position: 0% 50%;
            }
            50% {
                background-position: 100% 50%;
            }
            100% {
                background-position: 0% 50%;
            }
        }
        .login-card {
            background: rgba(255, 255, 255, 0.9);
            border-radius: 15px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        }
        .btn-primary {
            background-color: #28a745;
            border-color: #28a745;
        }
        .btn-primary:hover {
            background-color: #218838;
            border-color: #1e7e34;
        }
    </style>
</head>
<body class="d-flex align-items-center justify-content-center min-vh-100">
<div class="login-card p-4 p-md-5 w-100" style="max-width: 400px;">
    <h2 class="text-center mb-4 fw-bold text-success">电商助农平台</h2>
    <p class="text-center mb-4 text-muted">欢迎登录，助力乡村振兴！</p>

    <%-- 错误提示 --%>
    <% if (request.getAttribute("errorMessage") != null) { %>
    <div class="alert alert-danger text-center mb-3">
        <%= request.getAttribute("errorMessage") %>
    </div>
    <% } %>

    <form action="${pageContext.request.contextPath}/HelloServlet" method="post">
        <input type="hidden" name="action" value="login">

        <div class="mb-3">
            <label for="username" class="form-label">用户名</label>
            <input type="text" id="username" name="username"
                   class="form-control" placeholder="请输入用户名" required>
        </div>

        <div class="mb-4">
            <label for="password" class="form-label">密码</label>
            <input type="password" id="password" name="password"
                   class="form-control" placeholder="请输入密码" required>
        </div>

        <button type="submit" class="btn btn-primary w-100 mb-3">登录</button>
        <p class="text-center text-muted mt-3">
            还没有账号？<a href="register.jsp" class="text-success text-decoration-none">立即注册</a>
        </p>
    </form>
</div>
</body>
</html>
